package o;

import androidx.annotation.Nullable;

public class dw<E> implements Cloneable {
    private static final Object ˏ = new Object();
    private Object[] ˊ;
    private int ˋ;
    private boolean ˎ;
    private long[] ॱ;

    public /* synthetic */ Object clone() throws CloneNotSupportedException {
        return ˏ();
    }

    public dw() {
        this(10);
    }

    public dw(int i) {
        this.ˎ = false;
        if (i == 0) {
            this.ॱ = dt.ˊ;
            this.ˊ = dt.ˋ;
            return;
        }
        int ˋ = dt.ˋ(i);
        this.ॱ = new long[ˋ];
        this.ˊ = new Object[ˋ];
    }

    public dw<E> ˏ() {
        try {
            dw<E> dwVar = (dw) super.clone();
            dwVar.ॱ = (long[]) this.ॱ.clone();
            dwVar.ˊ = (Object[]) this.ˊ.clone();
            return dwVar;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError(e);
        }
    }

    @Nullable
    public E ˋ(long j) {
        return ˊ(j, null);
    }

    public E ˊ(long j, E e) {
        int ॱ = dt.ॱ(this.ॱ, this.ˋ, j);
        return (ॱ < 0 || this.ˊ[ॱ] == ˏ) ? e : this.ˊ[ॱ];
    }

    @Deprecated
    public void ॱ(long j) {
        ˏ(j);
    }

    public void ˏ(long j) {
        int ॱ = dt.ॱ(this.ॱ, this.ˋ, j);
        if (ॱ >= 0 && this.ˊ[ॱ] != ˏ) {
            this.ˊ[ॱ] = ˏ;
            this.ˎ = true;
        }
    }

    public void ॱ(int i) {
        if (this.ˊ[i] != ˏ) {
            this.ˊ[i] = ˏ;
            this.ˎ = true;
        }
    }

    private void ˋ() {
        int i = this.ˋ;
        long[] jArr = this.ॱ;
        Object[] objArr = this.ˊ;
        int i2 = 0;
        for (int i3 = 0; i3 < i; i3++) {
            Object obj = objArr[i3];
            if (obj != ˏ) {
                if (i3 != i2) {
                    jArr[i2] = jArr[i3];
                    objArr[i2] = obj;
                    objArr[i3] = null;
                }
                i2++;
            }
        }
        this.ˎ = false;
        this.ˋ = i2;
    }

    public void ˎ(long j, E e) {
        int ॱ = dt.ॱ(this.ॱ, this.ˋ, j);
        if (ॱ >= 0) {
            this.ˊ[ॱ] = e;
            return;
        }
        ॱ ^= -1;
        if (ॱ >= this.ˋ || this.ˊ[ॱ] != ˏ) {
            if (this.ˎ && this.ˋ >= this.ॱ.length) {
                ˋ();
                ॱ = dt.ॱ(this.ॱ, this.ˋ, j) ^ -1;
            }
            if (this.ˋ >= this.ॱ.length) {
                int ˋ = dt.ˋ(this.ˋ + 1);
                Object obj = new long[ˋ];
                Object obj2 = new Object[ˋ];
                System.arraycopy(this.ॱ, 0, obj, 0, this.ॱ.length);
                System.arraycopy(this.ˊ, 0, obj2, 0, this.ˊ.length);
                this.ॱ = obj;
                this.ˊ = obj2;
            }
            if (this.ˋ - ॱ != 0) {
                System.arraycopy(this.ॱ, ॱ, this.ॱ, ॱ + 1, this.ˋ - ॱ);
                System.arraycopy(this.ˊ, ॱ, this.ˊ, ॱ + 1, this.ˋ - ॱ);
            }
            this.ॱ[ॱ] = j;
            this.ˊ[ॱ] = e;
            this.ˋ++;
            return;
        }
        this.ॱ[ॱ] = j;
        this.ˊ[ॱ] = e;
    }

    public int ˎ() {
        if (this.ˎ) {
            ˋ();
        }
        return this.ˋ;
    }

    public long ˊ(int i) {
        if (this.ˎ) {
            ˋ();
        }
        return this.ॱ[i];
    }

    public E ˏ(int i) {
        if (this.ˎ) {
            ˋ();
        }
        return this.ˊ[i];
    }

    public int ˊ(long j) {
        if (this.ˎ) {
            ˋ();
        }
        return dt.ॱ(this.ॱ, this.ˋ, j);
    }

    public void ˊ() {
        int i = this.ˋ;
        Object[] objArr = this.ˊ;
        for (int i2 = 0; i2 < i; i2++) {
            objArr[i2] = null;
        }
        this.ˋ = 0;
        this.ˎ = false;
    }

    public void ˋ(long j, E e) {
        if (this.ˋ == 0 || j > this.ॱ[this.ˋ - 1]) {
            if (this.ˎ && this.ˋ >= this.ॱ.length) {
                ˋ();
            }
            int i = this.ˋ;
            if (i >= this.ॱ.length) {
                int ˋ = dt.ˋ(i + 1);
                Object obj = new long[ˋ];
                Object obj2 = new Object[ˋ];
                System.arraycopy(this.ॱ, 0, obj, 0, this.ॱ.length);
                System.arraycopy(this.ˊ, 0, obj2, 0, this.ˊ.length);
                this.ॱ = obj;
                this.ˊ = obj2;
            }
            this.ॱ[i] = j;
            this.ˊ[i] = e;
            this.ˋ = i + 1;
            return;
        }
        ˎ(j, e);
    }

    public String toString() {
        if (ˎ() <= 0) {
            return "{}";
        }
        StringBuilder stringBuilder = new StringBuilder(this.ˋ * 28);
        stringBuilder.append('{');
        for (int i = 0; i < this.ˋ; i++) {
            if (i > 0) {
                stringBuilder.append(", ");
            }
            stringBuilder.append(ˊ(i));
            stringBuilder.append('=');
            dw ˏ = ˏ(i);
            if (ˏ != this) {
                stringBuilder.append(ˏ);
            } else {
                stringBuilder.append("(this Map)");
            }
        }
        stringBuilder.append('}');
        return stringBuilder.toString();
    }
}
